'''
Created on 07/08/2013

@author: hackma
'''
from config.hipnoConstant import hipnoConstant
class HipnoCore(object):

        def do(self, obj, method):
            return method in dir(obj) and callable(getattr(obj, method))
        
        def run(self, obj, hipmethodo):
            dictio = {hipnoConstant.enum().VIEWINFO : hipnoConstant.enum().VIEWINFO, 
                      hipnoConstant.enum().EXPLOIT:hipnoConstant.enum().EXPLOIT}
            
            if hipmethodo == hipnoConstant.enum().RESTA:
                if self.do(obj, hipmethodo):
                    getattr(obj, hipmethodo)(2,1)
                    
            elif self.do(obj, dictio.get(hipmethodo)):
                    getattr(obj, dictio.get(hipmethodo))()